<?php
/**
 @prefix : <http://purl.org/net/ns/doas#> .
 @about: "<app/controllers/article_controller.php>", a: ":PHPScript",
 :shortdesc "This is a Instruments placeholder class.";
 :author [:name "Logue"; :homepage <http://logue.be/> ];
 :license <http://www.gnu.org/licenses/gpl-3.0.html>;
 :dependencies "none" .
*/
// Lorelei Article Instruments placeholder class
// Copyright (c)2008 Logue <http://logue.be/> All rights reserved.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

class InstrumentsController extends AppController {

	var $name = 'Instruments';
//	var $scaffold;

	function beforeRender() {
		parent::beforeFilter();
		if ($this->layout == 'ajax') {
			Configure::write('debug', 0);
		} else {
			parent::beforeRender();
		}
	}

	function json($id = null) {
		if ($id){
			$cond = array('Instrument.id'=>$id);
			$field = array('Instrument.minNote','Instrument.maxNote','Instrument.isDram','Instrument.flmml_inst');
		}else{
			$cond = null;
			$field = array('Instrument.id','Instrument.name');
		}
		$instruments = $this->Instrument->findAll($cond,$field);
		$this->set('instruments', json_encode($instruments));
		$this->layout = 'ajax';
	}
}
?>